import 'package:get/get.dart';
import 'package:xinxuan/http/http_util_service.dart';
import 'package:xinxuan/vo/logistics_vo.dart';

class LogisticsPageController extends GetxController {

  String companyCode = '';
  String trackingNumber = '';

  /// 物流数据
  var logisticsData = LogisticsData(nu: '', list: []).obs;
  
  @override
  void onReady() {
    super.onReady();
    Map<String, dynamic> argumentsMap = Get.arguments;
    companyCode = argumentsMap['companyCode'];
    trackingNumber = argumentsMap['trackingNumber'];
    getLogistics();
  }

  /// 获取物流信息
  getLogistics() async {
    LogisticsVo logisticsVo = await HttpUtilService.getLogistics(companyCode: companyCode, trackingNumber: trackingNumber);
    logisticsData.value = logisticsVo.data!;
    update();
  }

}